home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
THINKC
/
TCL1
/
JOHNLOVE
/
C_SOURCE
/
CMYPANE.C
< prev
next >
Wrap
Text File
|
1992-01-03
|
3KB
|
128 lines
/*********************************************************
"CmyPane.c"
by John A. Love, III [ Washington Apple Pi Users' Group]
using Symantec's "THINK C", v 5.0.1
... as derived from their "TCL Starter" files
*********************************************************/
/*
** Most applications will want a scrollable window, so this
** class is based on the class CPanorama. All the methods here
** would still apply to classes based directly on CPane.
*/
#include "CmyGlobals.h"
#include "CmyPane.h"
void CStarterPane::IStarterPane (CView *anEnclosure, CBureaucrat *aSupervisor,
short aWidth, short aHeight,
short aHEncl, short aVEncl,
SizingOption aHSizing, SizingOption aVSizing) {
CPanorama::IPanorama(anEnclosure, aSupervisor, aWidth, aHeight,
aHEncl, aVEncl, aHSizing, aVSizing);
} /* IStarterPane */
/* Draw
**
** In this method, you draw whatever you need to display in
** your pane. The area parameter gives the portion of the
** pane that needs to be redrawn. Area is in frame coordinates.
*/
void CStarterPane::Draw (Rect *area) {
/* draw your stuff */
} /* Draw */
/* DoClick
**
** The mouse went down in the pane.
** In this method you do whatever is appropriate for your
** application. HitPt is given in frame coordinates. The other
** parameters, modiferKeys and when, are taken from the event
** record.
**
** If you want to implement mouse tracking, this is the method
** to do it in. You need to create a subclass of CMouseTask and
** pass it in a TrackMouse() message to the pane.
*/
void CStarterPane::DoClick (Point hitPt, short modifierKeys, long when) {
// what happens when the mouse goes down:
} /* DoClick */
/* HitSamePart
**
** Test whether pointA and pointB are in the same part.
** "The same part" means different things for different applications.
** In the default method, "the same part" means "in the same pane."
** If you want a different behavior, override this method. For instance,
** two points might be in the same part if they're within n pixels
** of each other.
**
** PointA and pointB are both in frame coordinates.
*/
Boolean CStarterPane::HitSamePart (Point pointA, Point pointB) {
return inherited::HitSamePart(pointA, pointB);
} /* HitSamePart */
/* AdjustCursor
**
** If you want the cursor to have a different shape in your pane,
** do it in this method. If you want a different cursor for different
** parts of the same pane, you'll need to change the mouseRgn like this:
** 1. Create a region for the "special area" of your pane.
** 2. Convert this region to global coordinates
** 3. Set the mouseRgn to the intersection of this region
** and the original mouseRgn: SectRgn(mouseRgn, myRgn, mouseRgn);
**
** The default method just sets the cursor to the arrow. If this is fine
** for you, don't override this method.
*/
void CStarterPane::AdjustCursor(Point where, RgnHandle mouseRgn) {
inherited::AdjustCursor(where, mouseRgn);
} /* AdjustCursor */
/* ScrollToSelection
**
** If your pane is based on a Panorama (as this example is), you might
** want to define what it means to have a selection and what it means to
** scroll to that selection.
*/
void CStarterPane::ScrollToSelection (void) {
// scroll to the selection:
} /* ScrollToSelection */
/* end: "CmyPane.c" */